package br.com.rpinfo.helpdesk;

import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = ClienteDao.NAME_TABLE, schema = ClienteDao.NAME_SCHEMA)
public class Cliente implements Serializable {

  public static final String ATRIBBUTE_ID = "id";
  public static final String ATRIBBUTE_NOME = "nome";
  @Id
  @SequenceGenerator(name = ClienteDao.NAME_SEQUENCE,
          sequenceName = ClienteDao.NAME_SEQUENCE,
          schema = ClienteDao.NAME_SCHEMA)
  @GeneratedValue(strategy = GenerationType.AUTO, generator = ClienteDao.NAME_SEQUENCE)
  private int id;
  @Column(name = ClienteDao.NAME_COLUMN_NOME, nullable = false)
  private String nome;

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getNome() {
    return nome;
  }

  public void setNome(String nome) {
    this.nome = nome;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = 71 * hash + this.id;
    hash = 71 * hash + Objects.hashCode(this.nome);
    return hash;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final Cliente other = (Cliente) obj;
    if (this.id != other.id) {
      return false;
    }
    return Objects.equals(this.nome, other.nome);
  }

}
